package com.acme.bankapp.client.validator;

public class CmdValidator implements Validator<String> {

    protected static final String MESSAGE_BYE = "^bye";
    protected static final String MESSAGE_REPORT = "^report";
    protected static final String MESSAGE_ADD = "^add\\s+accounttype=(c|s);"
	    + "balance=(\\d+|\\d+\\.\\d+);"
	    + "(overdraft=(\\d+|\\d+\\.\\d+);){0,1}" + "name=\\w+;"
	    + "gender=(m|f);$";

    @Override
    public boolean validate(final String addCommand) {
	return addCommand.matches(MESSAGE_ADD)
		|| addCommand.matches(MESSAGE_BYE)
		|| addCommand.matches(MESSAGE_REPORT);
    }
}
